<!--<script type="text/javascript">
    $(function() {
            $('#file_upload').uploadify({
                    'fileTypeDesc' : 'Image Files',
                    'fileTypeExts' : '*.gif; *.jpg; *.png; *.jpeg',
                    'swf'      : '<?php echo base_url();?>uploadify/uploadify.swf',
                    'uploader' : '<?php echo base_url();?>uploadify/uploadify.php',
                    'script'         : '<?php echo site_url('AddNews/do_upload'); ?>',
                    'uploadLimit' : 1
                    // Your options here
            });
    });
</script>-->
<script type="text/javascript">
    if ($.browser.msie && $.browser.version <= 9)
    {
        alert('You Are Using An Outdated Browser! Switch To Chrome Or FireFox.');
    }
    var array = []
    $(document).ready(function() {

        function validate_input(attname, attinput, atterror) {
            if (!attname) {
                $(attinput).attr('class', "inp-form-error");
                $(atterror).attr('style', 'visibility:visible');
                array.push(false);
            } else {
                $(attinput).attr('class', "inp-form");
                $(atterror).attr('style', 'visibility:hidden');
                array.push(true);
            }
        }

        $("input[name='submit']").click(function() {

            var name = $("input[name='newsName']").val();
            var select = $("input[name='upload']").val();

            array.length = 0;

            validate_input(name, "input[name='newsName']", "div[id='error_newsname']");
            validate_input(select, "", "div[id='error_newsselect']");

            for (var i in array) {
                if (!array[i]) {
                    return false;
                    break;
                }
            }
        });

        function readURL(input) {

            if (input.files && input.files[0]) {
                var reader = new FileReader();

                reader.onload = function(e) {
                    $('#newsPreview').attr('src', e.target.result);
                }

                reader.readAsDataURL(input.files[0]);
            }
        }

        $("#newsSelect").change(function() {
            readURL(this);
        });

    });

    var reader = new FileReader();
    reader.onload = function(e) {
        document.getElementById("newsPreview").src = e.target.result;
    };

    function readURL(input) {
        if (input.files && input.files[0]) {
            reader.readAsDataURL(input.files[0]);
        }
        else {
            document.getElementById("newsPreview").src = input.value || "No file selected";
        }
    }
</script>

<div id="content-outer">
    <div id="content">


        <div id="page-heading"><h1><?php echo $main_title;?></h1></div>


        <table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
            <tbody>
                <tr>
                    <th rowspan="3" class="sized"><img src="<?php echo base_url(); ?>images/shared/side_shadowleft.jpg" width="20" height="300" alt=""></th>
                    <th class="topleft"></th>
                    <td id="tbl-border-top">&nbsp;</td>
                    <th class="topright"></th>
                    <th rowspan="3" class="sized"><img src="<?php echo base_url(); ?>images/shared/side_shadowright.jpg" width="20" height="300" alt=""></th>
                </tr>
                <tr>
                    <td id="tbl-border-left"></td>
                    <td>
                        <!--  start content-table-inner -->
                        <div id="content-table-inner">

                            <table border="0" width="100%" cellpadding="0" cellspacing="0">
                                <tbody><tr valign="top">
                                        <td>
                                            <?php // echo form_open_multipart("AddNews/UploadFile"); ?>
                                            <?php echo form_open_multipart("AddNews/uploadFile"); ?>
                                            <table border="0" cellpadding="0" cellspacing="0" id="id-form">
                                                <tbody>
                                                    <tr>
                                                        <th valign="top">Name News:</th>
                                                        <td><? echo form_input($newsName, $news['news_name'], 'class="inp-form"'); ?></td>
                                                        <td>
                                                            <div id="error_newsname" style="visibility: hidden">
                                                                <div class="error-left"></div>
                                                                <div class="error-inner">This field is required.</div>
                                                            </div>
                                                        </td>
                                                        <td></td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            &nbsp;
                                                        </td>
                                                    </tr>
                                                    <?php if ($action != 'view') { ?>
                                                        <tr>
                                                            <th valign="top">Select Image:</th>
<!--                                                            <td> <input type="file" name="file_upload" id="file_upload" /></td>-->
                                                            <td><?php echo form_upload('upload'); ?></td>
                                                            <td>
                                                                <div id="error_newsselect" style="visibility: hidden">
                                                                    <div class="error-left"></div>
                                                                    <div class="error-inner">This field is required.</div>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    <?php } ?>
                                                    <tr>
                                                        <td>
                                                            &nbsp;
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th valign="top">Preview:</th>
                                                        <td colspan="2">
                                                            <img name="newsPreview" id="newsPreview" style="border:none;width:600px;height:300px" src="<?php echo base_url().$news['news_path']; ?>"  />   
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            &nbsp;
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th>&nbsp;</th>
                                                        <td valign="top">
                                                            <?php if($action != 'view'):?>
                                                                <? echo form_submit('submit', 'submit', 'class="form-submit"'); ?>
                                                                <? echo form_button('reset', 'Reset', 'class="form-reset"'); ?>
                                                            <?php else:?>
                                                                <?php echo anchor( base_url().'index.php/ViewNews', '<img src="'.base_url().'images/forms/form_back.gif" alt="Back" />' ) ;?>
                                                            <? endif;?>
                                                        </td>
                                                        <td></td>
                                                    </tr>
                                                </tbody></table>
                                            <?php echo form_close(); ?>
                                            <!-- end id-form  -->

                                        </td>
                                        <td>



                                        </td>
                                    </tr>
                                    <tr>
                                        <td><img src="images/shared/blank.gif" width="695" height="1"></td>
                                        <td></td>
                                    </tr>
                                </tbody></table>

                            <div class="clear"></div>


                        </div>
                        <!--  end content-table-inner  -->
                    </td>
                    <td id="tbl-border-right"></td>
                </tr>
                <tr>
                    <th class="sized bottomleft"></th>
                    <td id="tbl-border-bottom">&nbsp;</td>
                    <th class="sized bottomright"></th>
                </tr>
            </tbody></table>

        <div class="clear">&nbsp;</div>

    </div>
</div>